package com.czh.zhiwen.model.enums;

import org.apache.commons.lang3.ObjectUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * app类型枚举
 *
 * @author @Author czh
 *
 */
public enum AppTypeEnum {

    SCORE("得分类", 1),

    TEST("测评类",0);

    private final String text;

    private final int value;

    AppTypeEnum(String text, int value) {
        this.text = text;
        this.value = value;
    }
    public static AppTypeEnum getAppTypeEnum(int value){
        if(ObjectUtils.isEmpty(value)){
            return null;
        }
        for(AppTypeEnum appTypeEnum:AppTypeEnum.values()){
            if(appTypeEnum.value==value){
                return appTypeEnum;
            }
        }
        return null;
    }

    /**
     * 获取所有枚举值
     * @return
     */
    public static List<Integer> getValues(){
        return Arrays.stream(values()).map(item -> item.value).collect(Collectors.toList());
    }


    public int getValue() {
        return value;
    }

    public String getText() {
        return text;
    }

}
